<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/offer.css') ?>
<?php
    if(!isset ($this->searchMode)){
        $this->actionName = 'catalog';
        $this->placeholder = 'Szukaj w firmach i instytucjach';
        $this->searchCode = $this->category['code'];
        echo $this->render('search/search-partial.phtml');
    }
?>
<div class="offer_list thumbnails">
    <?php foreach ($this->offers as $i => $entry): ?>
        <?php
        $url = $this->url(array('controller' => 'catalog', 'action' => 'show', 'id' => $entry['code'], 'title' => $entry['title']), 'default', true);
        ?>
        <div class="media offer_row thumbnail offer-type-<?= $entry['type'] ?>">
            <div class="pull-left">
                <a class="img_prev" style="background-image: url(<?= $this->url(array('id' => empty($entry['image_code']) ? 0 : $entry['image_code'], 'width' => 110, 'height' => 85), 'image', true) ?>);" href="<?= $url ?>">&nbsp;</a>
            </div>
            <div class="media-body">
                <h3 class="media-heading"><a href="<?= $url ?>"><?= $this->escape($entry['title']) ?></a></h3>
                <div class="desc">
                    <?php
                    if ($entry['type'] == Application_Model_DAO_Catalog::TYPE_PAID) {
                        $filter = new Zend_Filter_StripTags();
                        $text = $filter->filter($entry['description']);
                        $text = wordwrap($text, 220, '#&|&#');
                        $text = explode('#&|&#', $text);
                        if (count($text) > 1) {
                            $text = $text[0] . '...';
                        } else {
                            $text = $text[0];
                        }
                        echo $text;
                    }
                    ?>
                </div>
            </div>
        </div>
    <?php endforeach ?>
</div>
    <?php if($this->offers instanceof Zend_Paginator) {
    echo $this->offers;
} 
?>